Evaluator: A programmable expression evaluator
==============================================

Evaluator is a small RISC OS-application that evaluates numerical expres-
sions. It also can handle userdefined functions in this expressions!

It simulates the EVAL-function of BASIC: it is like you are at the BASIC
prompt evaluating expressions. (In fact the program uses the EVAL-function:
see below.) The program expects input from the keyboard, for instance the
numeric keypad. After a Return (or a click on the EXE-button) the result
will be shown in the window. If you are not satisfied with the expression
you can edit it: you can place the caret at every position in the expression
you want.

In an expression are allowed:

Arithmetical operators (see below)
Variables (see below)
Decimal constants:
    x or xEn
    (with x a real or integer, n an integer)
Hexadecimal constants:
    &x
    (with x a hexadecimal number)
Binary constants:
    %x
    (with x a binary number)
Functions:
    SIN COS TAN ASN ACS ATN DEG RAD
    SQR LN LOG EXP
    INT ABS SGN
    RND PI
    LEN ASC
Userdefined functions:
    FNx with x the name of the function

Don't forget the multiplication operator when you use brackets: 2*(3+4)
instead of 2(3+4).

Numerical expressions give numerical results. Additionally you can assign
a numerical result to a variable. 26 variables are defined: from a to z.
Allowed is an assignment-statement like:
<variable> = <expression>
From then you can use <variable> in any expression.

For more information about expressions: see the BBC BASIC user guide.

Userdefined functions
---------------------

This expression evaluator is programmable! You can program your own
functions and use them in the expressions. For instance: if you program
the function FNfac(x) to calculate the faculty of x, you can use this
function in expressions like:
FNfac(6)/FNfac(4)
How do you program userdefined functions? You simply program them in BASIC
and save the program as UserFN. This library of functions will be loaded
by the Evaluator-program, when you execute it. A UserFN-library must always
exist in the same directory as Evaluator is located, otherwise an error will
result.

Every function which gives a numerical result is allowed. For an expla-
nation of functions: see the BBC BASIC user guide.

Priority
--------

The priority of the operators is as follows:

1  - +             unary minus and plus
   SIN etc.        functions
   ( )             brackets
2  ^               raise to the power
3  * / DIV MOD     multiplication, division, integer
                   division and integer remainder
4  + -             addition and subtraction

Buttons in window
-----------------

The meaning of the three buttons in the window of Evaluator is as
follows:
C   : clears the expression,
MC  : clears the memory, i.e. the 26 variables,
EXE : executes the expression (same function as Return on the key-
      board).
   
Examples
--------

Here are some examples of numerical expressions:

12+3*4^2
12+(3*(4^2))
2.1E-3/12
4*1024*1024
(-24+SQR(24^2-4*3*5))/(2*3)
12^3
x=3.56*PI
x/2
z=LOG(100)/LN(2)

COS(RAD(45))
ABS(2*4-5*7)

Number conversion:

&EF
%1010010

ASCII codes:

ASC("A")


Walther Schoonenberg


Send comments and suggestions to:

Walther Schoonenberg
Brouwersgracht 190 C
1013 HC Amsterdam
The Netherlands
